{% extends "admin_base.html" %}

{% block content %}
<div class="card border-0 shadow-sm">
    <div class="card-header bg-white border-0 py-3">
        <h5 class="mb-0"><i class="bi bi-credit-card me-2"></i> 添加新银行卡</h5>
    </div>
    <div class="card-body">
        <form method="POST" action="{{ url_for('add_card') }}">
            <div class="row">
                <div class="col-md-6 mb-3">
                    <label for="card_id" class="form-label">银行卡号</label>
                    <input type="text" class="form-control" id="card_id" name="card_id" required>
                </div>
                <div class="col-md-6 mb-3">
                    <label for="card_type" class="form-label">银行卡类型</label>
                    <input type="text" class="form-control" id="card_type" name="card_type" required>
                </div>
            </div>
            
            <div class="row">
                <div class="col-md-6 mb-3">
                    <label for="saving_id" class="form-label">存款类型ID</label>
                    <input type="text" class="form-control" id="saving_id" name="saving_id">
                </div>
                <div class="col-md-6 mb-3">
                    <label for="open_date" class="form-label">开户日期</label>
                    <input type="date" class="form-control" id="open_date" name="open_date">
                </div>
            </div>
            
            <div class="row">
                <div class="col-md-6 mb-3">
                    <label for="open_money" class="form-label">开户金额</label>
                    <input type="number" class="form-control" id="open_money" name="open_money" step="0.01" required>
                </div>
                <div class="col-md-6 mb-3">
                    <label for="balance" class="form-label">当前余额</label>
                    <input type="number" class="form-control" id="balance" name="balance" step="0.01" required>
                </div>
            </div>
            
            <div class="row">
                <div class="col-md-6 mb-3">
                    <label for="password" class="form-label">密码</label>
                    <input type="text" class="form-control" id="password" name="password" required>
                </div>
                <div class="col-md-6 mb-3">
                    <label for="customer_id" class="form-label">客户</label>
                    <select class="form-select" id="customer_id" name="customer_id" required>
                        <option value="">选择客户</option>
                        {% for customer in customers %}
                        <option value="{{ customer[0] }}">{{ customer[1] }} (ID: {{ customer[0] }})</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
            
            <div class="mb-3 form-check">
                <input type="checkbox" class="form-check-input" id="loss" name="loss">
                <label class="form-check-label" for="loss">是否挂失</label>
            </div>
            
            <div class="d-flex justify-content-end">
                <a href="{{ url_for('manage_cards') }}" class="btn btn-secondary me-2">取消</a>
                <button type="submit" class="btn btn-primary">添加银行卡</button>
            </div>
        </form>
    </div>
</div>
{% endblock %}